<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="DCOS,微服务,API网关,gateway,Marathon-LB,Marathon,Mesos,KONG,Galileo,Datadog," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="当前互联网特别是移动互联网，设备与平台之间的交互的基础是服务API接口。以API驱动的开发是团队之间最常用的协作方式，而作为交互的基石，API的准确性，完整性和及时性是影响开发效率的关键。
在生产环境中，创建、发布、维护、监控和保护任意规模的API，接收和处理成千上万个并发API的调用，管理流量、授权和访问控制、监控以及API版本也是采用微服务架构所必须解决的问题。">
<meta property="og:type" content="article">
<meta property="og:title" content="API网关 on DC/OS - KONG">
<meta property="og:url" content="http://chrisrc.me/2017/02/11/api-gateway-kong-on-dcos/index.html">
<meta property="og:site_name" content="山中，山外与俯瞰">
<meta property="og:description" content="当前互联网特别是移动互联网，设备与平台之间的交互的基础是服务API接口。以API驱动的开发是团队之间最常用的协作方式，而作为交互的基石，API的准确性，完整性和及时性是影响开发效率的关键。
在生产环境中，创建、发布、维护、监控和保护任意规模的API，接收和处理成千上万个并发API的调用，管理流量、授权和访问控制、监控以及API版本也是采用微服务架构所必须解决的问题。">
<meta property="og:image" content="http://chrisrc.me/images/kong-architecture.png">
<meta property="og:image" content="http://chrisrc.me/images/kong-dashboard-home.png">
<meta property="og:image" content="http://chrisrc.me/images/kong-dashboard-apis-mgt.png">
<meta property="og:image" content="http://chrisrc.me/images/kong-dashboard-apis-add.png">
<meta property="og:image" content="http://chrisrc.me/images/kong-dashboard-consumers.png">
<meta property="og:image" content="http://chrisrc.me/images/kong-dashboard-consumer-edit.png">
<meta property="og:image" content="http://chrisrc.me/images/kong-dashboard-apis-plugin.png">
<meta property="og:image" content="http://chrisrc.me/images/dcos-api-gateway-deployments.png">
<meta property="og:image" content="http://chrisrc.me/images/dcos-api-gateway-kong-service-list.png">
<meta property="og:image" content="http://chrisrc.me/images/dcos-api-gateway-kong-service-api.png">
<meta property="og:updated_time" content="2017-02-11T04:04:20.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="API网关 on DC/OS - KONG">
<meta name="twitter:description" content="当前互联网特别是移动互联网，设备与平台之间的交互的基础是服务API接口。以API驱动的开发是团队之间最常用的协作方式，而作为交互的基石，API的准确性，完整性和及时性是影响开发效率的关键。
在生产环境中，创建、发布、维护、监控和保护任意规模的API，接收和处理成千上万个并发API的调用，管理流量、授权和访问控制、监控以及API版本也是采用微服务架构所必须解决的问题。">
<meta name="twitter:image" content="http://chrisrc.me/images/kong-architecture.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://chrisrc.me/2017/02/11/api-gateway-kong-on-dcos/"/>





  <title> API网关 on DC/OS - KONG | 山中，山外与俯瞰 </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  










  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">山中，山外与俯瞰</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">一次永不停止的探索之旅</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-dcos">
          <a href="/dcos" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-book"></i> <br />
            
            DC/OS
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="st-search-show-outputs">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <form class="site-search-form">
  <input type="text" id="st-search-input" class="st-search-input st-default-search-input" />
</form>

<script type="text/javascript">
  (function(w,d,t,u,n,s,e){w['SwiftypeObject']=n;w[n]=w[n]||function(){
    (w[n].q=w[n].q||[]).push(arguments);};s=d.createElement(t);
    e=d.getElementsByTagName(t)[0];s.async=1;s.src=u;e.parentNode.insertBefore(s,e);
  })(window,document,'script','//s.swiftypecdn.com/install/v2/st.js','_st');

  _st('install', 'R9GcmhBwxpsAGLNCsquZ','2.0.0');
</script>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="http://chrisrc.me/2017/02/11/api-gateway-kong-on-dcos/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="chrisrc">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="/images/avatar.gif">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="山中，山外与俯瞰">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="山中，山外与俯瞰" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                API网关 on DC/OS - KONG
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2017-02-11T18:28:18+08:00">
                2017-02-11
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/DC-OS/" itemprop="url" rel="index">
                    <span itemprop="name">DC/OS</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <a href="/2017/02/11/api-gateway-kong-on-dcos/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="2017/02/11/api-gateway-kong-on-dcos/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          

          
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>当前互联网特别是移动互联网，设备与平台之间的交互的基础是服务API接口。以API驱动的开发是团队之间最常用的协作方式，而作为交互的基石，API的准确性，完整性和及时性是影响开发效率的关键。</p>
<p>在生产环境中，创建、发布、维护、监控和保护任意规模的API，接收和处理成千上万个并发API的调用，管理流量、授权和访问控制、监控以及API版本也是采用微服务架构所必须解决的问题。</p>
<a id="more"></a>
<p>解决上述问题的一种方案是<a href="http://microservices.io/patterns/apigateway.html" target="_blank" rel="external">API网关（API Gateway）</a>，API网关的主要职责是提供统一的服务入口，让微服务对前端透明，并提供路由，缓存，安全，过滤，流量控制等管理功能</p>
<p>API网关在网络拓扑中位于客户端和后端服务之间，当前互联网架构中，在这个位置扮演重要角色的通常是反向代理和负载平衡系统如Nginx，因此，扩展Nginx（结合LUA）实现API网关的职能也是一种常见的方案，Mashape公司开发的<a href="https://getkong.org/" target="_blank" rel="external">KONG</a>项目正是基于这种思路实现的一个开源产品。</p>
<h3 id="KONG"><a href="#KONG" class="headerlink" title="KONG"></a>KONG</h3><p>KONG是一个通过<a href="https://github.com/openresty/lua-nginx-module" target="_blank" rel="external">lua-nginx-module</a>实现的在Nginx中运行的Lua应用程序。KONG没有使用lua-nginx-module直接编译Nginx，而是基于<a href="https://openresty.org/" target="_blank" rel="external">OpenResty</a>，与已经包含了lua-nginx-module的OpenResty一起分发。</p>
<p>KONG支持用Cassandra和PostgreSQL作为数据存储服务器，负载存储来自Kong操作的数据，同时，借助于Nginx，OpenResty和Lua插件体系，KONG作为API网关具备了高性能，高扩展性和灵活性。</p>
<p><img src="/images/kong-architecture.png" alt=""></p>
<p>KONG提供了API支持用户自定义插件扩展，并实现了众多的插件支持API网关的职能：</p>
<ul>
<li><p>认证<br>HTTP基本认证，密钥认证，OAuth，JWT，HMAC和LDAP</p>
</li>
<li><p>安全<br>ACL，CORS（ Cross-origin Resource Sharing，跨域资源共享），动态SSL，IP限定和机器人侦测</p>
</li>
<li><p>流量控制<br>请求限流，请求响应限流，请求载荷限定</p>
</li>
<li><p>分析与监控<br>Galileo，Datadog，Runscope</p>
</li>
<li><p>数据转换<br>请求转换，响应转换，请求/响应关联</p>
</li>
<li><p>日志记录<br>TCP，UDP，HTTP，文件日志，Syslog，StatsD和Loggly。</p>
</li>
</ul>
<h4 id="安装部署"><a href="#安装部署" class="headerlink" title="安装部署"></a>安装部署</h4><p>KONG提供了多种部署方式，支持Docker容器部署，AWS部署，CentOS/RedHat，Debian/Ubuntu，Heroku，OSX，Vagrant和源代码编译部署。</p>
<p>以Docker容器部署为例：</p>
<ol>
<li><p>启动数据库（这里使用Cassandra，使用PostgreSQL时请参考官方文档）：</p>
 <figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div></pre></td><td class="code"><pre><div class="line">$ docker run -d --name kong-database \</div><div class="line">    -p 9042:9042 \</div><div class="line">    cassandra:2.2</div></pre></td></tr></table></figure>
</li>
<li><p>启动KONG服务实例：</p>
 <figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line">$ docker run -d --name kong \</div><div class="line">    --link kong-database:kong-database \</div><div class="line">    -e &quot;KONG_DATABASE=cassandra&quot; \</div><div class="line">    -e &quot;KONG_CASSANDRA_CONTACT_POINTS=kong-database&quot; \</div><div class="line">    -p 8000:8000 \</div><div class="line">    -p 8443:8443 \</div><div class="line">    -p 8001:8001 \</div><div class="line">    -p 7946:7946 \</div><div class="line">    -p 7946:7946/udp \</div><div class="line">    kong</div></pre></td></tr></table></figure>
</li>
<li><p>检查KONG是否正常启动：</p>
 <figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">$ curl http://127.0.0.1:8001</div></pre></td></tr></table></figure>
</li>
<li><p>使用KONG，可参考官方<strong><a href="https://getkong.org/docs/latest/getting-started/quickstart" target="_blank" rel="external">5分钟快速上手示例</a></strong>。</p>
</li>
</ol>
<h4 id="配置管理"><a href="#配置管理" class="headerlink" title="配置管理"></a>配置管理</h4><p>Mashape官方为KONG提供了商业化的在线监控分析工具Galileo和在线API开发工具Gelato。</p>
<p>Github上也存在一些第三方开发的工具，涉及图形化配置管理的有<a href="https://github.com/vikingco/django-kong-admin" target="_blank" rel="external">Django Kong Admin</a>，<a href="https://github.com/rsdevigo/jungle" target="_blank" rel="external">Jungle</a>，<a href="https://github.com/PGBI/kong-dashboard" target="_blank" rel="external">Kong Dashboard</a>等，下面简要介绍<strong>Kong Dashboard</strong>的功能。</p>
<p>Kong Dashboard是用Javascript实现的，可以通过NPM或Docker等方式方便的安装和启动：</p>
<p><strong>NPM方式：</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div></pre></td><td class="code"><pre><div class="line"># Install Kong Dashboard</div><div class="line">npm install -g kong-dashboard</div><div class="line"></div><div class="line"># Start Kong Dashboard</div><div class="line">kong-dashboard start</div><div class="line"></div><div class="line"># To start Kong Dashboard on a custom port</div><div class="line">kong-dashboard start -p [port]</div><div class="line"></div><div class="line"># To start Kong Dashboard with basic auth</div><div class="line">kong-dashboard start -a user=password</div><div class="line"></div><div class="line"># You can set basic auth user with environment variables</div><div class="line"># Do not set -a parameter or this will be overwritten</div><div class="line">set kong-dashboard-name=admin &amp;&amp; set kong-dashboard-pass=password &amp;&amp; kong-dashboard start</div></pre></td></tr></table></figure>
<p><strong>Docker方式：</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line"># Start Kong Dashboard</div><div class="line">docker run -d -p 8080:8080 pgbi/kong-dashboard</div><div class="line"></div><div class="line"># Start Kong Dashboard on a custom port</div><div class="line">docker run -d -p [port]:8080 pgbi/kong-dashboard</div><div class="line"></div><div class="line"># Start Kong Dashboard with basic auth</div><div class="line">docker run -d -p 8080:8080 pgbi/kong-dashboard npm start -- -a user=password</div></pre></td></tr></table></figure>
<p>通过浏览器打开，可以看到如下界面：</p>
<p><img src="/images/kong-dashboard-home.png" alt=""></p>
<p>通过界面可以方便的管理API，用户和插件。</p>
<p>管理API：</p>
<p><img src="/images/kong-dashboard-apis-mgt.png" alt=""></p>
<p>添加API：</p>
<p><img src="/images/kong-dashboard-apis-add.png" alt=""></p>
<p>管理用户：</p>
<p><img src="/images/kong-dashboard-consumers.png" alt=""></p>
<p>添加用户：</p>
<p><img src="/images/kong-dashboard-consumer-edit.png" alt=""></p>
<p>管理插件：</p>
<p><img src="/images/kong-dashboard-apis-plugin.png" alt=""></p>
<h4 id="主要功能"><a href="#主要功能" class="headerlink" title="主要功能"></a>主要功能</h4><p>KONG作为API网关，其核心功能是代理客户端的请求并通过丰富的插件进行处理，此外KONG还支持集群部署，CLI命令行管理，丰富的管理API便于第三方集成以及插件开发API便于用户开发自己的处理插件。详细信息请参考<a href="https://getkong.org/docs/" target="_blank" rel="external">官方文档</a>。</p>
<h3 id="KONG-与-DC-OS-的结合"><a href="#KONG-与-DC-OS-的结合" class="headerlink" title="KONG 与 DC/OS 的结合"></a>KONG 与 DC/OS 的结合</h3><p><img src="/images/dcos-api-gateway-deployments.png" alt=""></p>
<p>如上图所示，API网关与DC/OS的整合存在两种模式，在模式1中，API网关独立于DC/OS集群之外，Marathon-LB部署于公开节点上作为外部负载均衡服务；在模式2中，API网关位于在DC/OS集群内部，部署在<strong>公开节点</strong>上（也可以部署在<strong>私有节点</strong>上，此时需要额外的Marathon-LB作为<strong>外部</strong>负载均衡服务），Marathon-LB作为<strong>内部</strong>负载均衡服务。</p>
<p>KONG作为API网关与DC/OS集群的整合既可以按上述模式1方式部署也可以按模式2进行。按模式2部署时，API网关是单实例覆盖全业务还是按业务进行实例拆分也可以根据实际需求进行调整。</p>
<p>下述步骤按单实例覆盖全业务的模式进行部署实践，其他场景可以根据实际需要调整。在此场景中，客户端请求的流动过程如下：</p>
<p><strong> 客户端请求 &lt;—&gt; Marathon-LB (“external”) &lt;—&gt; KONG &lt;—&gt; Marathon-LB (“internal”) &lt;—&gt; 内部服务 </strong></p>
<ol>
<li><p>部署Marathon-LB (“external”)：</p>
 <figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">dcos package install marathon-lb</div></pre></td></tr></table></figure>
</li>
<li><p>部署KONG所需的数据库：</p>
<p> 部署KONG所需要的Cassandra存储（也可以使用PostgreSQL）。<strong>注意</strong>，Kong 0.9.x（含）之前的版本仅支持Cassandra 2.2，Kong 0.10开始支持Cassandra 3.x。</p>
<p> 下述是Cassandra 2.2的应用部署JSON定义：</p>
 <figure class="highlight json"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div></pre></td><td class="code"><pre><div class="line">&#123;</div><div class="line">    <span class="attr">"id"</span>: <span class="string">"/kong/cassandra2"</span>,</div><div class="line">    <span class="attr">"instances"</span>: <span class="number">1</span>,</div><div class="line">    <span class="attr">"cpus"</span>: <span class="number">0.5</span>,</div><div class="line">    <span class="attr">"mem"</span>: <span class="number">2048</span>,</div><div class="line">    <span class="attr">"disk"</span>: <span class="number">0</span>,</div><div class="line">    <span class="attr">"container"</span>: &#123;</div><div class="line">        <span class="attr">"docker"</span>: &#123;</div><div class="line">            <span class="attr">"image"</span>: <span class="string">"cassandra:2.2"</span>,</div><div class="line">            <span class="attr">"forcePullImage"</span>: <span class="literal">false</span>,</div><div class="line">            <span class="attr">"privileged"</span>: <span class="literal">false</span>,</div><div class="line">            <span class="attr">"portMappings"</span>: [</div><div class="line">                &#123;</div><div class="line">                    <span class="attr">"containerPort"</span>: <span class="number">9042</span>,</div><div class="line">                    <span class="attr">"protocol"</span>: <span class="string">"tcp"</span>,</div><div class="line">                    <span class="attr">"hostPort"</span>: <span class="number">9042</span>,</div><div class="line">                    <span class="attr">"servicePort"</span>: <span class="number">10121</span></div><div class="line">                &#125;</div><div class="line">            ],</div><div class="line">            <span class="attr">"network"</span>: <span class="string">"BRIDGE"</span></div><div class="line">        &#125;,</div><div class="line">        <span class="attr">"type"</span>: <span class="string">"DOCKER"</span>,</div><div class="line">        <span class="attr">"volumes"</span>: [</div><div class="line">            &#123;</div><div class="line">                <span class="attr">"containerPath"</span>: <span class="string">"/var/lib/cassandra"</span>,</div><div class="line">                <span class="attr">"hostPath"</span>: <span class="string">"/data/cassandra/2.2"</span>,</div><div class="line">                <span class="attr">"mode"</span>: <span class="string">"RW"</span></div><div class="line">            &#125;</div><div class="line">        ]</div><div class="line">    &#125;,</div><div class="line">    <span class="attr">"healthChecks"</span>: [</div><div class="line">        &#123;</div><div class="line">            <span class="attr">"protocol"</span>: <span class="string">"TCP"</span>,</div><div class="line">            <span class="attr">"gracePeriodSeconds"</span>: <span class="number">60</span>,</div><div class="line">            <span class="attr">"intervalSeconds"</span>: <span class="number">30</span>,</div><div class="line">            <span class="attr">"timeoutSeconds"</span>: <span class="number">30</span>,</div><div class="line">            <span class="attr">"maxConsecutiveFailures"</span>: <span class="number">3</span></div><div class="line">        &#125;</div><div class="line">    ],</div><div class="line">    <span class="attr">"portDefinitions"</span>: [</div><div class="line">        &#123;</div><div class="line">            <span class="attr">"port"</span>: <span class="number">10121</span>,</div><div class="line">            <span class="attr">"protocol"</span>: <span class="string">"tcp"</span>,</div><div class="line">            <span class="attr">"labels"</span>: &#123;&#125;</div><div class="line">        &#125;</div><div class="line">    ],</div><div class="line">    <span class="attr">"requirePorts"</span>: <span class="literal">false</span></div><div class="line">&#125;</div></pre></td></tr></table></figure>
</li>
<li><p>部署KONG：</p>
 <figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">dcos marathon app add kong.json</div></pre></td></tr></table></figure>
<p> KONG的Marathon应用程序JSON定义如下：</p>
 <figure class="highlight json"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div><div class="line">97</div><div class="line">98</div><div class="line">99</div></pre></td><td class="code"><pre><div class="line">&#123;</div><div class="line">    <span class="attr">"id"</span>: <span class="string">"/kong"</span>,</div><div class="line">    <span class="attr">"cmd"</span>: <span class="string">"KONG_NGINX_DAEMON=\"off\" KONG_CLUSTER_ADVERTISE=$HOST:$PORT3 kong start"</span>,</div><div class="line">    <span class="attr">"cpus"</span>: <span class="number">1</span>,</div><div class="line">    <span class="attr">"mem"</span>: <span class="number">512</span>,</div><div class="line">    <span class="attr">"disk"</span>: <span class="number">0</span>,</div><div class="line">    <span class="attr">"instances"</span>: <span class="number">1</span>,</div><div class="line">    <span class="attr">"acceptedResourceRoles"</span>: [<span class="string">"*"</span>],</div><div class="line">    <span class="attr">"container"</span>: &#123;</div><div class="line">        <span class="attr">"type"</span>: <span class="string">"DOCKER"</span>,</div><div class="line">        <span class="attr">"volumes"</span>: [],</div><div class="line">            <span class="attr">"docker"</span>: &#123;</div><div class="line">            <span class="attr">"image"</span>: <span class="string">"kong"</span>,</div><div class="line">            <span class="attr">"network"</span>: <span class="string">"BRIDGE"</span>,</div><div class="line">            <span class="attr">"portMappings"</span>: [</div><div class="line">                &#123;</div><div class="line">                    <span class="attr">"containerPort"</span>: <span class="number">8000</span>,</div><div class="line">                    <span class="attr">"hostPort"</span>: <span class="number">0</span>,</div><div class="line">                    <span class="attr">"servicePort"</span>: <span class="number">10001</span>,</div><div class="line">                    <span class="attr">"protocol"</span>: <span class="string">"tcp"</span>,</div><div class="line">                    <span class="attr">"name"</span>: <span class="string">"proxy"</span>,</div><div class="line">                    <span class="attr">"labels"</span>: &#123;&#125;</div><div class="line">                &#125;,</div><div class="line">                &#123;</div><div class="line">                    <span class="attr">"containerPort"</span>: <span class="number">8001</span>,</div><div class="line">                    <span class="attr">"hostPort"</span>: <span class="number">0</span>,</div><div class="line">                    <span class="attr">"servicePort"</span>: <span class="number">10002</span>,</div><div class="line">                    <span class="attr">"protocol"</span>: <span class="string">"tcp"</span>,</div><div class="line">                    <span class="attr">"name"</span>: <span class="string">"admin"</span>,</div><div class="line">                    <span class="attr">"labels"</span>: &#123;&#125;</div><div class="line">                &#125;,</div><div class="line">                &#123;</div><div class="line">                    <span class="attr">"containerPort"</span>: <span class="number">8443</span>,</div><div class="line">                    <span class="attr">"hostPort"</span>: <span class="number">0</span>,</div><div class="line">                    <span class="attr">"servicePort"</span>: <span class="number">10003</span>,</div><div class="line">                    <span class="attr">"protocol"</span>: <span class="string">"tcp"</span>,</div><div class="line">                    <span class="attr">"name"</span>: <span class="string">"ssl"</span>,</div><div class="line">                    <span class="attr">"labels"</span>: &#123;&#125;</div><div class="line">                &#125;,</div><div class="line">                &#123;</div><div class="line">                    <span class="attr">"containerPort"</span>: <span class="number">7946</span>,</div><div class="line">                    <span class="attr">"hostPort"</span>: <span class="number">0</span>,</div><div class="line">                    <span class="attr">"servicePort"</span>: <span class="number">10004</span>,</div><div class="line">                    <span class="attr">"protocol"</span>: <span class="string">"tcp,udp"</span>,</div><div class="line">                    <span class="attr">"name"</span>: <span class="string">"serf"</span>,</div><div class="line">                    <span class="attr">"labels"</span>: &#123;&#125;</div><div class="line">                &#125;</div><div class="line">            ],</div><div class="line">            <span class="attr">"privileged"</span>: <span class="literal">false</span>,</div><div class="line">            <span class="attr">"parameters"</span>: [],</div><div class="line">            <span class="attr">"forcePullImage"</span>: <span class="literal">true</span></div><div class="line">        &#125;</div><div class="line">    &#125;,</div><div class="line">    <span class="attr">"env"</span>: &#123;</div><div class="line">        <span class="attr">"KONG_CASSANDRA_CONTACT_POINTS"</span>: <span class="string">"node.cassandra.l4lb.thisdcos.directory"</span>,</div><div class="line">        <span class="attr">"KONG_DATABASE"</span>: <span class="string">"cassandra"</span></div><div class="line">    &#125;,</div><div class="line">    <span class="attr">"healthChecks"</span>: [</div><div class="line">        &#123;</div><div class="line">            <span class="attr">"protocol"</span>: <span class="string">"TCP"</span>,</div><div class="line">            <span class="attr">"portIndex"</span>: <span class="number">1</span>,</div><div class="line">            <span class="attr">"gracePeriodSeconds"</span>: <span class="number">300</span>,</div><div class="line">            <span class="attr">"intervalSeconds"</span>: <span class="number">60</span>,</div><div class="line">            <span class="attr">"timeoutSeconds"</span>: <span class="number">20</span>,</div><div class="line">            <span class="attr">"maxConsecutiveFailures"</span>: <span class="number">3</span>,</div><div class="line">            <span class="attr">"ignoreHttp1xx"</span>: <span class="literal">false</span></div><div class="line">        &#125;</div><div class="line">    ],</div><div class="line">    <span class="attr">"labels"</span>: &#123;</div><div class="line">        <span class="attr">"HAPROXY_1_GROUP"</span>: <span class="string">"external"</span>,</div><div class="line">        <span class="attr">"HAPROXY_0_GROUP"</span>: <span class="string">"external"</span></div><div class="line">    &#125;,</div><div class="line">    <span class="attr">"portDefinitions"</span>: [</div><div class="line">        &#123;</div><div class="line">            <span class="attr">"port"</span>: <span class="number">10001</span>,</div><div class="line">            <span class="attr">"protocol"</span>: <span class="string">"tcp"</span>,</div><div class="line">            <span class="attr">"name"</span>: <span class="string">"proxy"</span>,</div><div class="line">            <span class="attr">"labels"</span>: &#123;&#125;</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="attr">"port"</span>: <span class="number">10002</span>,</div><div class="line">            <span class="attr">"protocol"</span>: <span class="string">"tcp"</span>,</div><div class="line">            <span class="attr">"name"</span>: <span class="string">"admin"</span>,</div><div class="line">            <span class="attr">"labels"</span>: &#123;&#125;</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="attr">"port"</span>: <span class="number">10003</span>,</div><div class="line">            <span class="attr">"protocol"</span>: <span class="string">"tcp"</span>,</div><div class="line">            <span class="attr">"name"</span>: <span class="string">"ssl"</span>,</div><div class="line">            <span class="attr">"labels"</span>: &#123;&#125;</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="attr">"port"</span>: <span class="number">10004</span>,</div><div class="line">            <span class="attr">"protocol"</span>: <span class="string">"udp"</span>,</div><div class="line">            <span class="attr">"name"</span>: <span class="string">"serf-udp"</span>,</div><div class="line">            <span class="attr">"labels"</span>: &#123;&#125;</div><div class="line">        &#125;</div><div class="line">    ]</div><div class="line">&#125;</div></pre></td></tr></table></figure>
</li>
<li><p>部署Marathon-LB (“internal”)：</p>
 <figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">dcos package install --options=marathon-lb-internal.json marathon-lb</div></pre></td></tr></table></figure>
<p> 对应的Marathon应用JSON定义如下：</p>
 <figure class="highlight json"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line">&#123;</div><div class="line">    <span class="attr">"marathon-lb"</span>:&#123;</div><div class="line">        <span class="attr">"name"</span>:<span class="string">"marathon-lb-internal"</span>,</div><div class="line">        <span class="attr">"haproxy-group"</span>:<span class="string">"internal"</span>,</div><div class="line">        <span class="attr">"bind-http-https"</span>:<span class="literal">false</span>,</div><div class="line">        <span class="attr">"role"</span>:<span class="string">""</span></div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
</li>
<li><p>部署内部服务</p>
<p> 注意，本方案里用 <strong>“internal”</strong> Marathon-LB作为内部应用服务的负载均衡器，因此在部署应用服务时，在LABEL中“HAPROXY_GROUP”的值应设置为<strong>“internal”</strong>。<br>本例使用3个Nginx实例作为服务示例。</p>
</li>
<li><p>部署Kong Dashboard管理程序：</p>
 <figure class="highlight json"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div></pre></td><td class="code"><pre><div class="line">&#123;</div><div class="line">    <span class="attr">"id"</span>: <span class="string">"/kong-dashboard"</span>,</div><div class="line">    <span class="attr">"instances"</span>: <span class="number">1</span>,</div><div class="line">    <span class="attr">"cpus"</span>: <span class="number">0.1</span>,</div><div class="line">    <span class="attr">"mem"</span>: <span class="number">128</span>,</div><div class="line">    <span class="attr">"disk"</span>: <span class="number">0</span>,</div><div class="line">    <span class="attr">"container"</span>: &#123;</div><div class="line">        <span class="attr">"docker"</span>: &#123;</div><div class="line">            <span class="attr">"image"</span>: <span class="string">"pgbi/kong-dashboard"</span>,</div><div class="line">            <span class="attr">"forcePullImage"</span>: <span class="literal">false</span>,</div><div class="line">            <span class="attr">"privileged"</span>: <span class="literal">false</span>,</div><div class="line">            <span class="attr">"portMappings"</span>: [</div><div class="line">                &#123;</div><div class="line">                    <span class="attr">"containerPort"</span>: <span class="number">8080</span>,</div><div class="line">                    <span class="attr">"protocol"</span>: <span class="string">"tcp"</span>,</div><div class="line">                    <span class="attr">"servicePort"</span>: <span class="number">10305</span>,</div><div class="line">                    <span class="attr">"labels"</span>: &#123;</div><div class="line">                        <span class="attr">"VIP_0"</span>: <span class="string">"/kong-dashboard:8080"</span></div><div class="line">                    &#125;</div><div class="line">                &#125;</div><div class="line">            ],</div><div class="line">            <span class="attr">"network"</span>: <span class="string">"BRIDGE"</span></div><div class="line">        &#125;</div><div class="line">    &#125;,</div><div class="line">    <span class="attr">"healthChecks"</span>: [</div><div class="line">        &#123;</div><div class="line">            <span class="attr">"protocol"</span>: <span class="string">"HTTP"</span>,</div><div class="line">            <span class="attr">"path"</span>: <span class="string">"/"</span>,</div><div class="line">            <span class="attr">"gracePeriodSeconds"</span>: <span class="number">60</span>,</div><div class="line">            <span class="attr">"intervalSeconds"</span>: <span class="number">60</span>,</div><div class="line">            <span class="attr">"timeoutSeconds"</span>: <span class="number">30</span>,</div><div class="line">            <span class="attr">"maxConsecutiveFailures"</span>: <span class="number">3</span>,</div><div class="line">            <span class="attr">"ignoreHttp1xx"</span>: <span class="literal">false</span></div><div class="line">        &#125;</div><div class="line">    ],</div><div class="line">    <span class="attr">"labels"</span>: &#123;</div><div class="line">        <span class="attr">"HAPROXY_GROUP"</span>: <span class="string">"internal"</span></div><div class="line">    &#125;,</div><div class="line">    <span class="attr">"portDefinitions"</span>: [</div><div class="line">        &#123;</div><div class="line">            <span class="attr">"port"</span>: <span class="number">10305</span>,</div><div class="line">            <span class="attr">"protocol"</span>: <span class="string">"tcp"</span>,</div><div class="line">            <span class="attr">"labels"</span>: &#123;&#125;</div><div class="line">        &#125;</div><div class="line">    ]</div><div class="line">&#125;</div></pre></td></tr></table></figure>
</li>
<li><p>检查KONG网关是否正常工作</p>
<p> 通过Kong Dashboard向API网关添加API接口，访问接口检查是否正常。</p>
</li>
<li><p>部署完成后，服务实例列表如下：</p>
<p> <img src="/images/dcos-api-gateway-kong-service-list.png" alt=""></p>
</li>
<li><p><strong>结论</strong>： 部署完成后，外部客户端通过外部MLB（192.168.1.51:10031）访问API网关KONG（192.168.1.81），KONG将请求代理给内部MLB（192.168.1.80）,内部MLB为三个Nginx服务（微服务示例）提供负载均衡。</p>
<p> <img src="/images/dcos-api-gateway-kong-service-api.png" alt=""></p>
<p> 通过以下CURL命令测试：</p>
 <figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">curl -i -X GET --url http://192.168.1.51:10301/ --header &apos;Host: 192.168.1.80&apos;</div></pre></td></tr></table></figure></li>
</ol>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>


    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/DCOS/" rel="tag"># DCOS</a>
          
            <a href="/tags/微服务/" rel="tag"># 微服务</a>
          
            <a href="/tags/API网关/" rel="tag"># API网关</a>
          
            <a href="/tags/gateway/" rel="tag"># gateway</a>
          
            <a href="/tags/Marathon-LB/" rel="tag"># Marathon-LB</a>
          
            <a href="/tags/Marathon/" rel="tag"># Marathon</a>
          
            <a href="/tags/Mesos/" rel="tag"># Mesos</a>
          
            <a href="/tags/KONG/" rel="tag"># KONG</a>
          
            <a href="/tags/Galileo/" rel="tag"># Galileo</a>
          
            <a href="/tags/Datadog/" rel="tag"># Datadog</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/02/10/storm-topology-shutdown/" rel="next" title="Storm拓扑自动重启">
                <i class="fa fa-chevron-left"></i> Storm拓扑自动重启
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/02/17/configuration-management-on-dcos-1/" rel="prev" title="微服务之配置管理（1）—— 概述">
                微服务之配置管理（1）—— 概述 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
        <div class="ds-share flat" data-thread-key="2017/02/11/api-gateway-kong-on-dcos/"
     data-title="API网关 on DC/OS - KONG"
     data-content=""
     data-url="http://chrisrc.me/2017/02/11/api-gateway-kong-on-dcos/">
  <div class="ds-share-inline">
    <ul  class="ds-share-icons-16">

      <li data-toggle="ds-share-icons-more"><a class="ds-more" href="javascript:void(0);">分享到：</a></li>
      <li><a class="ds-weibo" href="javascript:void(0);" data-service="weibo">微博</a></li>
      <li><a class="ds-qzone" href="javascript:void(0);" data-service="qzone">QQ空间</a></li>
      <li><a class="ds-qqt" href="javascript:void(0);" data-service="qqt">腾讯微博</a></li>
      <li><a class="ds-wechat" href="javascript:void(0);" data-service="wechat">微信</a></li>

    </ul>
    <div class="ds-share-icons-more">
    </div>
  </div>
</div>
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div class="ds-thread" data-thread-key="2017/02/11/api-gateway-kong-on-dcos/"
           data-title="API网关 on DC/OS - KONG" data-url="http://chrisrc.me/2017/02/11/api-gateway-kong-on-dcos/">
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/avatar.gif"
               alt="chrisrc" />
          <p class="site-author-name" itemprop="name">chrisrc</p>
          <p class="site-description motion-element" itemprop="description"></p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">69</span>
              <span class="site-state-item-name">日志</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              <a href="/categories">
                <span class="site-state-item-count">21</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">162</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/christtrc" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://twitter.com/chrisrc" target="_blank" title="Twitter">
                  
                    <i class="fa fa-fw fa-twitter"></i>
                  
                  Twitter
                </a>
              </span>
            
          
        </div>

        
        
          <div class="cc-license motion-element" itemprop="license">
            <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" target="_blank">
              <img src="/images/cc-by-nc-sa.svg" alt="Creative Commons" />
            </a>
          </div>
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#KONG"><span class="nav-number">1.</span> <span class="nav-text">KONG</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#安装部署"><span class="nav-number">1.1.</span> <span class="nav-text">安装部署</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#配置管理"><span class="nav-number">1.2.</span> <span class="nav-text">配置管理</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#主要功能"><span class="nav-number">1.3.</span> <span class="nav-text">主要功能</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#KONG-与-DC-OS-的结合"><span class="nav-number">2.</span> <span class="nav-text">KONG 与 DC/OS 的结合</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy;  2015 - 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">
     
      <a href="mailto:chrisrc@qq.com">chrisrc</a> 
    
  </span>
  <span class="author"> &nbsp; QQ: 58122705 </span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  

  
    
  

  <script type="text/javascript">
    var duoshuoQuery = {short_name:"chrisrc"};
    (function() {
      var ds = document.createElement('script');
      ds.type = 'text/javascript';ds.async = true;
      ds.id = 'duoshuo-script';
      ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
      ds.charset = 'UTF-8';
      (document.getElementsByTagName('head')[0]
      || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
  </script>

  
    
    
    <script src="/lib/ua-parser-js/dist/ua-parser.min.js?v=0.7.9"></script>
    <script src="/js/src/hook-duoshuo.js"></script>
  








  
  

  

  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  
<script>
(function(){
   var src = (document.location.protocol == "http:") ? "http://js.passport.qihucdn.com/11.0.1.js?ed903ab05fbc5fa64d95e4bfbf3d3a04":"https://jspassport.ssl.qhimg.com/11.0.1.js?ed903ab05fbc5fa64d95e4bfbf3d3a04";
   document.write('<script src="' + src + '" id="sozz"><\/script>');
})();
</script>

  


</body>
</html>
